<template>
    <view class="encapsulation_header">
        <view class="header_left" v-if="address">
            <view class="">
                <image src="@/static/images/路径 61.jpg" mode=""></image>
                <text class="header_name">{{ address.name }}</text>
                <text class="header_tal">{{ address.tel }}</text>
            </view>
            <text class="header_address">{{ address.province }}{{ address.city }}{{ address.county }}{{ address.details }}</text>
        </view>
        <view class="header_left" v-else>
            <view class="">
                <text class="header_name">请选择地址</text>
            </view>
        </view>
        <view class="header_right" @click="$u.route('/pages/Points/address/address', { mode: 'choose'})">
            <text>选择</text>
            <u-icon name="arrow-right"></u-icon>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                chooseKey: uni.$u.func.getRandomLetter(8)
            }
        },
        created() {
            this.init()
            
        },
        computed: {
            address(){
                return this.$u.vuex.get('user.selectAddress') 
            }
        },
        methods: {
            init(){
                this.$u.vuex.dispatch('user/getSelectAddress')
            }
        }
    }
</script>

<style scoped lang="scss">
    .encapsulation_header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 720rpx;
        height: 260rpx;
        padding-right: 30rpx;
        background-color: #FFFFFF;

        image {
            width: 30.57rpx;
            height: 33.97rpx;
        }

        .header_right {
            display: flex;
        }

        .header_left {
            margin: 53rpx 0 57rpx 30rpx;

            .header_name {
                margin: 0 18rpx 0 14rpx;
                font-family: PingFang SC, PingFang SC;
                font-weight: bold;
                font-size: 30rpx;
                color: #333333;
            }

            .header_tal {
                font-family: PingFang SC, PingFang SC;
                font-weight: bold;
                font-size: 30rpx;
                color: #333333;
                line-height: 0rpx;
            }

            .header_address {
                font-family: PingFang SC, PingFang SC;
                font-weight: 400;
                font-size: 24rpx;
                color: #666666;
                line-height: 0rpx;
            }
        }

    }
</style>